<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<title>管理系统 - 登录</title>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="renderer" content="webkit">
		<meta http-equiv="pragma" content="no-cache" />
		<meta name="viewport" content="user-scalable=0, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<link rel="shortcut icon" type="image/x-icon" href="/static/img/favicon.ico">
		<link rel="stylesheet" type="text/css" href="/static/lib/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="/static/lib/fontawesome/css/font-awesome.min.css">
		<style type="text/css">
			#loading {
				position: absolute;
				z-index: 1000;
				top: 0px;
				left: 0px;
				width: 100%;
				height: 100%;
				background: #f5f5f5;
				text-align: center;
				padding-top: 10%;
			}
			.login-window{
				margin:0 auto;
			}
			.login-window-body{
				padding:20px;
			}
			.error-tip{
				color: red;
			}
		</style>
	</head>
	<body class="easyui-layout">
		<div id="loading">
			<img src='/static/img/loading/wheel.gif'/>
			<h1><font color="#15428B">加载中···</font></h1>
		</div>
		<div class="easyui-window" title="登录" data-options="width:300,height:300,top:180,inline:true,border:'thin',collapsible:false,minimizable:false,maximizable:false,closable:false,draggable:false,resizable:false,cls:'login-window',bodyCls:'login-window-body',iconCls:'fa fa-sign-in'">
			<form id="login_form" action="/user/signin" method="post">
				<p class="error-tip">{{error.desc or error.errno}}</p>
				<div style="margin-bottom:20px">
					<input class="easyui-textbox" id="name" name="username" value="{{ username }}" prompt="帐号" iconWidth="28" style="width:100%;height:34px;padding:10px;">
				</div>
				<div style="margin-bottom:20px">
					<input class="easyui-passwordbox" id="password" name="password" prompt="密码" iconWidth="28" style="width:100%;height:34px;padding:10px;">
				</div>
				<div style="margin-bottom:20px">
					<a href="javascript:document:login_form.submit();" class="easyui-linkbutton" style="width:100%;height:34px;">登录</a>
				</div>
			</form>
		</div>
		
		<script type="text/javascript" src="/static/lib/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="/static/lib/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="/static/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript" src="/static/lib/json2/json2.js"></script>
		<script type="text/javascript">
			$.parser.onComplete = function() {
				$("#loading").fadeOut("slow", function() {
					$(this).remove();
				});
			}
			$(function() {
				$('#name').textbox('textbox').bind('keypress', function(e) {
					if (e.keyCode == 13) {
						$('#login_form').submit();
					}
				});
				$('#password').textbox('textbox').bind('keypress', function(e) {
					if (e.keyCode == 13) {
						$('#login_form').submit();
					}
				});
				$('#login_form').submit(function(){
					if (!$('#name').textbox('getValue')) {
						$('.error-tip').text('帐号不能为空');
						$('#name').textbox('textbox').focus();
						return false;
					}
					if (!$('#password').textbox('getValue')) {
						$('.error-tip').text('密码不能为空');
						$('#password').textbox('textbox').focus();
						return false;
					}
				});
				if (!$('#name').textbox('getValue')){
					$('#name').textbox('textbox').focus();
				}else{
					$('#password').textbox('textbox').focus();
				}
			});
		</script>
	</body>
</html>